package com.yangtao.prototype.common.tree;

import java.util.ArrayList;
import java.util.List;

/**
 * User: 杨涛
 * Date: 11-4-4
 * Time: 下午8:24
 */
public class TestTree implements TreeNode {
	private String id;
	private String name;
	private String path;
	private Integer level;
	private String dispOrder;
	private String parentId;
	private List<TestTree> subTree;

	public TestTree() {
	}

	public TestTree(String id, String name, String path, Integer level, String dispOrder, String parentId) {
		this.id = id;
		this.name = name;
		this.path = path;
		this.level = level;
		this.dispOrder = dispOrder;
		this.parentId = parentId;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public String getDispOrder() {
		return dispOrder;
	}

	public void setDispOrder(String dispOrder) {
		this.dispOrder = dispOrder;
	}

	public List<TestTree> getSubTree() {
		return subTree;
	}

	public void setSubTree(List<TestTree> subTree) {
		this.subTree = subTree;
	}

	/**
	 * 获取树节点的子节点属性
	 *
	 * @return
	 */
	@Override
	public List obtainChildren() {
		if (subTree == null)
			subTree = new ArrayList<TestTree>();
		return subTree;
	}

	/**
	 * 获取树节点的标识属性
	 *
	 * @return
	 */
	@Override
	public String obtainIdentity() {
		return id;
	}

	/**
	 * 获取树节点的父ID属性
	 *
	 * @return
	 */
	@Override
	public String obtainParentId() {
		return parentId;
	}

	/**
	 * 获取树的排序属性
	 *
	 * @return
	 */
	@Override
	public Comparable obtainOrder() {
		return dispOrder;
	}
}
